home *** CD-ROM | disk | FTP | other *** search
/ Palm Z22 / Palm Z22 CD.iso / pc / PalmSoftware.pkg / Contents / Resources / postflight < prev    next >
Text File  |  2005-08-11  |  10KB  |  150 lines

  1. #!/bin/sh
  2. # File name:  postflight.sh
  3. # Description:  
  4. # Copyright 2004, palmOne , Inc.
  5. #  
  6. # Modification History:
  7. #    <1>  05/06/04   JMP   Implemented
  8. #                     
  9.  
  10. if_not_mkdir () {
  11.     if [ ! -e "." ] 
  12.     then
  13.        mkdir "."
  14.     fi
  15. }
  16.  
  17.  
  18. ########    Fixing the Apps in the Applications/Palm folder   ###########    
  19. "$1/Contents/Resources/CpMac" "$1/Contents/Resources/SetFile" "$2Applications/Palm/SetFile"    
  20. chmod 777 "$2Applications/Palm/SetFile"
  21.  
  22. find "$2Applications/Palm/" -name "HotSync Manager"  -type d -print0 | xargs -0 "$2Applications/Palm/SetFile" -a B
  23. find "$2Applications/Palm/HotSync Manager/Contents/Plug-ins/" -name "USBNotifier"  -type d -print0 | xargs -0 "$2Applications/Palm/SetFile" -a B
  24. find "$2Applications/Palm/" -name "HotSync Manager"  -type f -print0 | xargs -0 "$2Applications/Palm/SetFile"-c Gld1 -t APPL
  25. find "$2Applications/Palm/" -name "Conduit Manager"  -type d -print0 | xargs -0 "$2Applications/Palm/SetFile" -a B
  26. find "$2Applications/Palm/" -name "Conduit Manager"  -type f -print0 | xargs -0 "$2Applications/Palm/SetFile"-c Gld3 -t APPL
  27. find "$2Applications/Palm/Palm Desktop/Contents/Resources/" -name "Palm Desktop Background.app"  -type d -print0 | xargs -0 "$2Applications/Palm/SetFile" -a B
  28. find "$2Applications/Palm/Palm Desktop/Contents/Resources/" -name "Palm Desktop Support.app"  -type d -print0 | xargs -0 "$2Applications/Palm/SetFile" -a B
  29. find "$2Applications/Palm/" -name "Palm Desktop"  -type d -print0 | xargs -0 "$2Applications/Palm/SetFile" -a B
  30. find "$2Applications/Palm/" -name "Palm Desktop"  -type f -print0 | xargs -0 "$2Applications/Palm/SetFile" -c POrg -t APPL
  31. find "$2Applications/Palm/" -name "Transport Monitor"  -type d -print0 | xargs -0 "$2Applications/Palm/SetFile" -a B
  32. find "$2Applications/Palm/" -name "Transport Monitor"  -type f -print0 | xargs -0 "$2Applications/Palm/SetFile" -c Gld2 -t APPL
  33. find "$2Applications/Palm/" -name "Palm Setup Assistant"  -type d -print0 | xargs -0 "$2Applications/Palm/SetFile" -a B
  34. find "$2Applications/Palm/" -name "Palm Setup Assistant"  -type f -print0 | xargs -0 "$2Applications/Palm/SetFile" -c PSA0 -t APPL
  35. find "$2Applications/Palm/" -name "Send To Handheld"  -type d -print0 | xargs -0 "$2Applications/Palm/SetFile" -a B
  36. find "$2Applications/Palm/" -name "Voice Memo"  -type d -print0 | xargs -0 "$2Applications/Palm/SetFile" -a B
  37. find "$2Applications/Palm/" -name "Note Pad"  -type d -print0 | xargs -0 "$2Applications/Palm/SetFile" -a B
  38. find "$2Applications/Palm/" -name "E-Reg"  -type d -print0 | xargs -0 "$2Applications/Palm/SetFile" -a B
  39. if [ -e "$1/../English/Essential_Software/Software Store" ]
  40.     then
  41.     "$1/Contents/Resources/CpMac" -r "$1/../English/Essential_Software/Software Store" "$2Applications/Palm/Add-On/English/"
  42.     fi
  43. find "$2Applications/Palm/" -name "*.pdb"  -type f -print0 | xargs -0 "$2Applications/Palm/SetFile" -c Gld1 -t "PDB "
  44. find "$2Applications/Palm/" -name "*.prc"  -type f -print0 | xargs -0 "$2Applications/Palm/SetFile" -c Gld1 -t "****"
  45. find "$2Applications/Palm/" -name "*.pdf"  -type f -print0 | xargs -0 "$2Applications/Palm/SetFile" -c CARO -t "PDF "
  46.  
  47. ########    copying the Documentation to /Applications/Palm" folder   ###########    
  48. echo $2 > ~/tmp.txt
  49. #"cat ~/tmp1.txt" | getline fld1; close("cat ~/tmp1.txt");
  50. echo $1 > ~/tmp1.txt
  51.  
  52. sudo -u $USER "$1/Contents/Resources/LocId.app/Contents/MacOS/LocId" > ~/loc.txt
  53. "$1/Contents/Resources/LocId.app/Contents/MacOS/LocId" | awk '  BEGIN {"cat ~/loc.txt" | getline loc; close("cat ~/loc.txt"); "cat ~/tmp.txt" | getline fld; close("cat ~/tmp.txt");"cat ~/tmp1.txt" | getline fld1; close("cat ~/tmp1.txt");package["English"]= "English/Documentation";package["Anglais"]= "English/Documentation";package["French"]= "Francais/Documentation";package["Francais"]= "Francais/Documentation";package["Italien"]= "Italiano/Documentation";package["Italian"]= "Italiano/Documentation";package["Italiano"]= "Italiano/Documentation";package["German"]= "Deutsch/Dokumentation";package["Deutsch"]= "Deutsch/Dokumentation";package["Deutsch"]= "Deutsch/Dokumentation";package["Spanish"]= "Espanol/Documentacion";package["Espanol"]= "Espanol/Documentacion";package["Portugues"]= "Portuguese/Documentacion";package["Portuguese"]= "Portuguese/Documentacion"}{if (package[loc]=="") lang="English/Documentation"; if (package[loc]!="") lang=package[loc];printf "if [ -e \"%s/../%s\" ]\nthen\n\"%s/Contents/Resources/CpMac\" -r \"%s/../%s\" \"%sApplications/Palm/\"\nfi\n", fld1, lang, fld1, fld1, lang, fld}'  > ~/tmp1.sh
  54. chmod 777 ~/tmp1.sh
  55. sh ~/tmp1.sh
  56.     
  57. ########    Fixing the Apps in the "Library/Application Support/Palm HotSync" folder   ###########    
  58. find "$2Library/Application Support/Palm HotSync/Conduits/" -name "*" -type d -print0 | xargs -0 "$2Applications/Palm/SetFile" -a B    
  59. "$2Applications/Palm/SetFile" -a b "$2Library/Application Support/Palm HotSync/Conduits"    
  60. find "$2Library/Application Support/Palm HotSync/Transports/" -name "*" -type d -print0 | xargs -0 "$2Applications/Palm/SetFile" -a B
  61. "$2Applications/Palm/SetFile" -a b  "$2Library/Application Support/Palm HotSync/Transports"
  62. find "$2Library/Application Support/Palm HotSync/Notifiers/" -name "Conflict Notifier" -type d -print0 | xargs -0 "$2Applications/Palm/SetFile" -a B
  63. find "$2Library/Application Support/Palm HotSync/Notifiers/" -name "Conflict Notifier" -type d -print0 | xargs -0 "$2Applications/Palm/SetFile"  -c Gld1 -t Gldc
  64.  
  65. ########    Deleting our Disabled Conduits if they exist    ###########
  66. if [ -e "$2Library/Application Support/Palm HotSync/Disabled Conduits/Address Conduit" ]
  67.     then 
  68.         rm -rf "$2Library/Application Support/Palm HotSync/Disabled Conduits/Address Conduit"
  69. fi
  70. if [ -e "$2Library/Application Support/Palm HotSync/Disabled Conduits/Contacts Conduit" ]
  71.     then 
  72.         rm -rf "$2Library/Application Support/Palm HotSync/Disabled Conduits/Contacts Conduit"
  73. fi
  74. if [ -e "$2Library/Application Support/Palm HotSync/Disabled Conduits/Calendar Conduit" ]
  75.     then 
  76.         rm -rf "$2Library/Application Support/Palm HotSync/Disabled Conduits/Calendar Conduit"
  77. fi
  78. if [ -e "$2Library/Application Support/Palm HotSync/Disabled Conduits/Datebook Conduit" ]
  79.     then 
  80.         rm -rf "$2Library/Application Support/Palm HotSync/Disabled Conduits/Datebook Conduit"
  81. fi
  82. if [ -e "$2Library/Application Support/Palm HotSync/Disabled Conduits/Memo Conduit" ]
  83.     then 
  84.         rm -rf "$2Library/Application Support/Palm HotSync/Disabled Conduits/Memo Conduit"
  85. fi
  86. if [ -e "$2Library/Application Support/Palm HotSync/Disabled Conduits/Memos Conduit" ]
  87.     then 
  88.         rm -rf "$2Library/Application Support/Palm HotSync/Disabled Conduits/Memos Conduit"
  89. fi
  90. if [ -e "$2Library/Application Support/Palm HotSync/Disabled Conduits/Tasks Conduit" ]
  91.     then 
  92.         rm -rf "$2Library/Application Support/Palm HotSync/Disabled Conduits/Tasks Conduit"
  93. fi
  94. if [ -e "$2Library/Application Support/Palm HotSync/Disabled Conduits/ToDo Conduit" ]
  95.     then 
  96.         rm -rf "$2Library/Application Support/Palm HotSync/Disabled Conduits/ToDo Conduit"
  97. fi
  98.  
  99. ########    Fixing the Apps in the "Library/CFMSupport" folder   ###########        
  100.  find "$2Library/CFMSupport/"  -name "Palm Conduit Library.cfm"  -type d -print0 | xargs -0 "$2Applications/Palm/SetFile" -a B
  101.  
  102. ########    Fixing the Apps in the "System/Library/Extensions" folder   ###########        
  103. find "$2System/Library/Extensions/" -name "HotSync Classic Seize.kext"  -type d -print0 | xargs -0 "$2Applications/Palm/SetFile" -a B
  104.  
  105.         chmod 777 "$2Applications/Palm/ConfigLaunchServices"
  106. "$1/Contents/Resources/LocId.app/Contents/MacOS/LocId" | awk '  BEGIN {"cat ~/tmp.txt" | getline fld; close("cat ~/ tmp.txt");printf "\"%sApplications/Palm/ConfigLaunchServices.app/Contents/MacOS/ConfigLaunchServices\" \"%sApplications/Palm\"", fld, fld}'  > ~/tmp.sh
  107. chmod 777 ~/tmp.sh
  108. ##sudo -u $USER ~/tmp.sh
  109. "$2Applications/Palm/ConfigLaunchServices.app/Contents/MacOS/ConfigLaunchServices" "$2Applications/Palm"
  110. sudo -u $USER "$2Applications/Palm/ConfigLaunchServices.app/Contents/MacOS/ConfigLaunchServices" "$2Applications/Palm"
  111.  
  112.  
  113. ###########Copying and running the InstallAddOn script
  114.         "$1/Contents/Resources/CpMac" "$1/Contents/Resources/InstallAddOn.App" "$2Applications/Palm/Add-On/InstallAddOn.App"
  115. #        "$1/Contents/Resources/LocId.app/Contents/MacOS/LocId" > ~/loc.txt
  116.         rm -f "$2Applications/Palm/SetFile"
  117.        rm -rf "$2Applications/Palm/ConfigLaunchServices.app"
  118.        `open -a "$2Applications/Palm/Add-On/InstallAddOn.App"`
  119.        ##"$2Applications/Palm/Add-On/InstallAddOn.App"
  120.         IS_UTIL_RUNNING=0
  121.         while [ $IS_UTIL_RUNNING -ne 0 ] ; do
  122.                 # Only check every 8 seconds to prevent script from hogging the CPU
  123.                 sleep 8
  124.                 IS_UTIL_RUNNING="`ps -x -o command | grep "InstallAddOn" | grep -v grep | wc -l`"
  125.         done
  126.  
  127. rm -rf "~/Library/Preferences/Palm Desktop Info"
  128. rm -rf "~/Library/Preferences/PowerReg Prefs"
  129.  
  130.         rm -f ~/tmp.txt
  131.         rm -f ~/tmp.sh
  132.         rm -f ~/tmp1.sh
  133.         sudo chmod 775 "$2"
  134.         sudo chown :admin "$2"
  135.         sudo chmod 775 "$2Applications"
  136.         sudo chown :admin "$2Applications"
  137.         sudo chmod -R 775 "$2Applications/Palm"
  138.         sudo chown -R  :admin "$2Applications/Palm"
  139.         sudo chmod 775 "$2Library"
  140.         sudo chown :admin "$2Library"
  141.         sudo chmod -R 775 "$2Library/CFMSupport"
  142.         sudo chown -R :admin "$2Library/CFMSupport"
  143.         sudo chmod -R 775 "$2Library/Application Support"
  144.         sudo chown -R :admin "$2Library/Application Support"
  145.     exit 0
  146.